from org.apache.lucene.search import *
from org.apache.lucene.analysis import *
from org.apache.lucene.store import *
from org.apache.lucene.queryParser import *
import os

indexDir = r'C:\jylab\examples\index'
term = 'asynchronous'

fsDir = FSDirectory.getDirectory(indexDir, 0)
searcher = IndexSearcher(fsDir)
analyzer = StandardAnalyzer()
query = QueryParser.parse(term, "contents", analyzer);
hits = searcher.search (query)
for i in range (hits.length()):
  doc = hits.doc(i)
  print doc.get("filename").split(os.sep)[-1]
  
  
